var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
function authenticate(target, propertyKey, descriptor) {
    var originalMethod = descriptor.value;
    descriptor.value = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        // 在此添加身份验证逻辑
        console.log("Authenticator大爷开始验明正身...");
        // 调用原始方法
        return originalMethod.apply(this, args);
    };
    return descriptor;
}
function log(target, propertyKey, descriptor) {
    var originalMethod = descriptor.value;
    descriptor.value = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        // 在此添加日志记录逻辑
        console.log("logger\u5927\u7237\u5F00\u59CB\u8F93\u51FA\u65E5\u5FD7: " + propertyKey);
        // 调用原始方法
        return originalMethod.apply(this, args);
    };
    return descriptor;
}
function errorHandler(target, propertyKey, descriptor) {
    // 原来的 getUser方法
    var originalMethod = descriptor.value;
    // 重新给 getUser方法 赋值
    descriptor.value = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        try {
            // 调用原始方法
            return originalMethod.apply(this, args);
        }
        catch (error) {
            console.log("errorHandler大爷捕获到错误:");
            // 在此添加错误处理逻辑
            console.error("\n      ==================\uD83E\uDD2A\uD83E\uDD2A\uD83E\uDD2A\uD83E\uDD2A\uD83E\uDD2A==================\n      Error occurred in method " + propertyKey + ":" + error + "\n      =================\u613F\u5929\u5802\u6CA1\u6709BUG==================\n      ");
            // 返回适当的错误响应
        }
    };
    return descriptor;
}
var UserController = /** @class */ (function () {
    function UserController() {
    }
    UserController.prototype.getUser = function (id) {
        // 获取用户逻辑
        console.log("\u6267\u884C\u6B63\u5E38\u4E1A\u52A1\u903B\u8F91:Getting user with ID " + id);
        // 返回相应的用户数据
        if (Math.random() > 0.5) {
            throw new Error("人品不好");
        }
    };
    __decorate([
        authenticate,
        log,
        errorHandler
    ], UserController.prototype, "getUser", null);
    return UserController;
}());
new UserController().getUser("123");
